home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
IRIX Installation Tools & Overlays 2002 November
/
SGI IRIX Installation Tools & Overlays 2002 November - Disc 4.iso
/
dist
/
cluster_admin.idb
/
usr
/
cluster
/
bin
/
cdbreinit.z
/
cdbreinit
Wrap
Text File
|
2002-10-15
|
4KB
|
149 lines
#!/bin/sh
#
# Copyright (C) 1998, Silicon Graphics, Inc.
# All Rights Reserved.
#
# UNPUBLISHED -- Rights reserved under the copyright laws of the United
# States. Use of a copyright notice is precautionary only and does not
# imply publication or disclosure.
#
# THIS SOFTWARE CONTAINS CONFIDENTIAL AND PROPRIETARY INFORMATION OF
# SILICON GRAPHICS, INC. ANY DUPLICATION, MODIFICATION, DISTRIBUTION, OR
# DISCLOSURE IS STRICTLY PROHIBITED WITHOUT THE PRIOR EXPRESS WRITTEN
# PERMISSION OF SILICON GRAPHICS, INC.
#
# U.S. GOVERNMENT RESTRICTED RIGHTS LEGEND
# Use, duplication or disclosure by the Government is subject to
# restrictions as set forth in FAR 52.227.19(c)(2) or subparagraph
# (c)(1)(ii) of the Rights in Technical Data and Computer Software
# clause at DFARS 252.227-7013 and/or in similar or successor clauses
# in the FAR, or the DOD or NASA FAR Supplement. Unpublished-- rights
# reserved under the copyright laws of the United States.
# Contractor/manufacturer is Silicon Graphics, Inc.,
# 2011 N. Shoreline Blvd., Mountain View, CA 94039-7311.
#
#
# Simple script to delete an existing CDB and then recreate a new one
# with the same name.
#
BINDIR=${rbase:-}/usr/cluster/bin
CDB_DB_DIR=$rbase/var/cluster/cdb
# cmond command timeout in seconds
CMON_TMOUT=10
CMON_RESTART="${BINDIR}/cmon_ctrl restart -r -f -t ${CMON_TMOUT} -g"
CLUSTER_ADMIN_GRP=cluster_admin
#
# Check if a database filename was specified
#
if [ "$1" = "" ]; then
echo "Assuming /var/cluster/cdb/cdb.db database"
DBFILE=/var/cluster/cdb/cdb.db
else
DBFILE=$1
fi
DBDIR="$DBFILE#"
PROMPT="Continue[y/n] "
#
# Make sure the user wants to delete this cdb and give
# them the option to abort if not
#
echo "Preparing to delete database at $DBFILE!"
read RESP?$PROMPT
if [ "$RESP" != "y" ]; then
# Abort
echo "Response was not yes, exiting..."
exit 0;
fi
#
# Stop all cluster process
#
echo "Stopping cluster processes"
/sbin/chkconfig cluster on
/etc/init.d/cluster stop
# kill fs2d if running
echo "Stopping fs2d process"
/sbin/killall -TERM fs2d
#
# Delete the cdb database directory and header file
#
echo "Removing database at $DBFILE..."
#
# Make sure the database header file exists, if it does, remove it
#
if [ ! -f $DBFILE ]; then
echo "Database header file $DBFILE doesn't exist"
else
echo "Removing database header file $DBFILE..."
/sbin/rm -f $DBFILE
echo "Deleted CDB header file $DBFILE"
fi
#
# Make sure the database directory exists, if it does, remove it
#
if [ ! -d $DBDIR ]; then
echo "Database directory $DBDIR doesn't exist"
else
echo "Removing database directory $DBDIR..."
/sbin/rm -rf $DBDIR
echo "Deleted CDB database at $DBFILE"
fi
echo "Recreating new CDB database at $DBFILE"
#
# If the CDB does not exist, create default CDB header and basic nodes.
#
if [ ! -f $DBFILE ]; then
/sbin/mkdir -p $CDB_DB_DIR
$BINDIR/cdbnew $DBFILE
fi
#
# Create HA and CXFS information in the database
#
if [ -f $DBFILE ]; then
# Check if local HA tree has been created
$BINDIR/cdbutil node "#local#HA" > /dev/null 2>&1
if [ $? -ne 0 ]; then
# if the CDB node does not exist, create local HA nodes
$BINDIR/cdbutil -F $BINDIR/cdb-init-local-HA-nodes -q dbfile $DBFILE
echo "Added HA information to CDB database in $DBFILE"
fi
# Check if local CXFS tree has been created
$BINDIR/cdbutil node "#local#Cellular" > /dev/null 2>&1
if [ $? -ne 0 ]; then
# if the CDB node does not exist, create local CXFS nodes
$BINDIR/cdbutil -F $BINDIR/cdb-init-local-CX-nodes -q dbfile $DBFILE
echo "Added CXFS information to CDB database in $DBFILE"
fi
fi
#
# Kill fs2d process and start cluster processes.
# fs2d would have started automatically when CDB is created.
#
/sbin/chkconfig cluster on
/etc/init.d/cluster start
echo "Started cluster processes"
# Exit with status 0
#
exit 0